import request from '@/utils/request'

/**
 * 分页查询面包
 */
export function getBreadPage(params) {
  return request({
    url: '/bread/page',
    method: 'get',
    params
  })
}

/**
 * 查询所有在售面包
 */
export function getBreadList() {
  return request({
    url: '/bread/list',
    method: 'get'
  })
}

/**
 * 获取面包详情
 */
export function getBreadDetail(id) {
  return request({
    url: `/bread/${id}`,
    method: 'get'
  })
}

/**
 * 新增面包
 */
export function addBread(data) {
  return request({
    url: '/bread',
    method: 'post',
    data
  })
}

/**
 * 更新面包
 */
export function updateBread(data) {
  return request({
    url: '/bread',
    method: 'put',
    data
  })
}

/**
 * 删除面包
 */
export function deleteBread(id) {
  return request({
    url: `/bread/${id}`,
    method: 'delete'
  })
}

/**
 * 库存变动
 */
export function changeStock(data) {
  return request({
    url: '/bread/changeStock',
    method: 'post',
    data
  })
}

/**
 * 查询库存变动记录
 */
export function getStockRecordPage(params) {
  return request({
    url: '/bread/stockRecord/page',
    method: 'get',
    params
  })
}

